package store.lunangangster.bpmn.converter.parser;

import javax.xml.stream.XMLStreamReader;
import store.lunangangster.bpmn.model.BaseElement;
import store.lunangangster.bpmn.model.BpmnModel;
import store.lunangangster.bpmn.model.definition.TimerEventDefinition;

public class TimeDateParser extends BaseChildElementParser {

  @Override
  public String getTargetName() {
    return ELEMENT_TIME_DATE;
  }

  @Override
  public void parseChild(XMLStreamReader xsr, BaseElement parentElement, BpmnModel model)
      throws Exception {
    if (parentElement instanceof TimerEventDefinition) {
      String timeDate = xsr.getElementText();
      ((TimerEventDefinition) parentElement).setTimeDate(timeDate);
    }
  }
}
